﻿<Page
    x:Class="PivotControlDynamicHeader.PivotPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:PivotControlDynamicHeader"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:data="using:PivotControlDynamicHeader.Data"
    mc:Ignorable="d"
    DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <Page.Transitions>
        <TransitionCollection>
            <NavigationThemeTransition>
                <NavigationThemeTransition.DefaultNavigationTransitionInfo>
                    <CommonNavigationTransitionInfo IsStaggeringEnabled="True"/>
                </NavigationThemeTransition.DefaultNavigationTransitionInfo>
            </NavigationThemeTransition>
        </TransitionCollection>
    </Page.Transitions>

    <Grid>
        <Pivot x:Uid="Pivot" Title="MY APPLICATION" 
               ItemsSource="{Binding Classrooms}"
               x:Name="pivot" CommonNavigationTransitionInfo.IsStaggerElement="True">
            <!--Pivot item one-->
            <Pivot.TitleTemplate>
                <DataTemplate>
                    <StackPanel  Orientation="Horizontal" Height="65">
                        <Image Height="50" Width="50"  Source="ms-appx:///Assets/shopping-trolley-no-bg.png"/>
                        <TextBlock x:Name="Title" Text="Lists" Height="25" FontSize="18" Margin="5"  FontWeight="Bold"/>
                    </StackPanel>
                </DataTemplate>
            </Pivot.TitleTemplate>
            <Pivot.HeaderTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Header}"></TextBlock>
                </DataTemplate>
            </Pivot.HeaderTemplate>
            <Pivot.ItemTemplate>
                <DataTemplate>
                    <ListView
                    ItemsSource="{Binding Persons}"
                    IsItemClickEnabled="True"
                    ItemClick="ItemView_ItemClick"
                    ContinuumNavigationTransitionInfo.ExitElementContainer="True" FontSize="12" Foreground="#FFF0CCA7" FontStyle="Italic">
                        <ListView.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock x:Name="AddShoppingItem" 
                                            Text="{Binding FirstName}"
                                            Style="{StaticResource ListViewItemContentTextBlockStyle}"
                                            Pivot.SlideInAnimationGroup="1" 
                                            CommonNavigationTransitionInfo.IsStaggerElement="True"/>

                                    <TextBlock
                                    Text="{Binding LastName}"
                                    TextWrapping="WrapWholeWords"
                                    Pivot.SlideInAnimationGroup="2" 
                                    CommonNavigationTransitionInfo.IsStaggerElement="True" 
                                    Style="{ThemeResource ListViewItemContentTextBlockStyle}"
                                    Margin="22,0,19,0"/>
                                </StackPanel>
                            </DataTemplate>
                        </ListView.ItemTemplate>

                    </ListView>

                </DataTemplate>
            </Pivot.ItemTemplate>
        </Pivot>
    </Grid>

    <Page.BottomAppBar>
        <CommandBar>
            <AppBarButton x:Uid="AddAppBarButton" x:Name="AddAppBarButton" Label="add" Icon="Add" Click="AddAppBarButton_Click" />
            <CommandBar.SecondaryCommands>
                <AppBarButton x:Uid="SecondaryButton1" x:Name="SecondaryButton1" Label="secondary command 1" />
                <AppBarButton x:Uid="SecondaryButton2" x:Name="SecondaryButton2" Label="secondary command 2" />
            </CommandBar.SecondaryCommands>
        </CommandBar>
    </Page.BottomAppBar>
</Page>
